<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="js/vue.js"></script>
    <link rel="stylesheet" href="css/swiper.min.css">
</head>
<body>
    <div id="box">
        {{ msg | parseTime }}
    </div>
    <script src="js/swiper.min.js"></script>
    <script>
       
       Vue.filter("parseTime",(val) => {
           //console.log(val);
           var date = new Date(Number(val))
           var y = date.getFullYear();
           var m = date.getMonth()+1;// 这里要加一，因为getmonth得到的值是月份的索引
           var d = date.getDate();
           var h = date.getHours();
           var f = date.getMinutes();
           var s = date.getSeconds();
           return y + "年" + m + "月" + d + "日 " + h + "时" + f + "分" + s + "秒"
       })
        
        // 生命周期函数
        const vm = new Vue({
            el:"#box",
            data:{
                msg:"1630655734470"
            },
            
        })
    </script>
</body>
</html>